#ifndef tmGridMenu_h__
#define tmGridMenu_h__

#include "./tmInclude.h"
#include "./tmControl.h"
#include "./tmAnimation.h"

class tmTimer;

class tmGridMenu : public tmControl
{
public:
	typedef enum _ItemType
	{
		Navigation,
		Service,
		FaultCheck,
		Computer,
		Dail,
		Music,
		DouBan,
		Distributor
	}ItemType;
#define ITEM_ROWS   2
#define ITEM_COLS	15
	public:
		class tmGridMenuItem 
		{
			public:
				BOOL getLabelName();
				BOOL createFrom(char* name,GLES::PointI& pos);
				VOID setPosition(GLES::PointI& pos);
				VOID movePosition(GLES::Vector2I& vec);
				const GLES::PointI& getPosition();
			public:
				GLES::PictLabel _label;
		};

		public:
			BOOL initialise(GLES::RectI& rect);
			VOID finalise(){};
			VOID draw(GLES::Painter* painter);
			VOID onTimer(tmTimer* timer);

			virtual VOID onInput( int x,int y,InputType type );
			virtual VOID onPressed(int x,int y);
			virtual VOID onDragged(int x,int y);
			virtual VOID onPressRelease(int x,int y);
			virtual VOID onDragRelease(int x,int y);
		private:
			tmGridMenuItem _Items[ITEM_COLS][ITEM_ROWS];
			tmSlidingAnim  _anim;
			int _presX;
			int _presY;
};

#endif // tmGridMenu_h__